/**
 * 自定义方法
 */

//	localStorage.setItem('un', "admin");
//	localStorage.setItem('pw', "MdYkh6KFDkw");
//	localStorage.setItem('workcenterGid', "4028830b4ffcf65e015046548af50a90");
//	localStorage.setItem('workcenterCode', "01010104_D");
//	localStorage.setItem('workcenterName', "D线");
//	localStorage.setItem('serverUrl', "10.1.1.142");
//	localStorage.setItem('serverIp', "10.1.1.142");
//	localStorage.setItem('serverPort', "8080");
//	localStorage.setItem('serverProject', "uma-unimax-web");
	

	//获取副屏数据
	function getRemoteData(workCenterGid, workCellGid, nowTime) {
		var un = localStorage.getItem('un');
		var pw = localStorage.getItem('pw');
		var serverIp = localStorage.getItem('serverIp');
		var serverPort = localStorage.getItem('serverPort');
		var serverProject = localStorage.getItem('serverProject');
		var url = "http://" + serverIp + ":" + serverPort + "/" + serverProject + "/autoLoginController!login.m?_u=" + un + "&_p=" + pw + "&_to=uqcmTestController!getRight3.m&type=" + type + "&typeKey=" + workCenterGid + "&typeValue=" + workCenterCode + "&userName=" + userName + "&layoutShow=PCT_TV_SCR";
//		api.ajax({
//			url : url,
//			method : 'post',
//			dataType : 'json',
//			data : {
//				nowTime : nowTime
//			}
//		}, function(ret, err) {
//			var data = eval(ret);
//			$("#right112").text(data.planQty);
//			$("#right122").text(data.reportQty);
//			$("#right312").text(data.wrongQty);
//			$("#right212").text(data.equipQty);
//			$("#right222").text(data.startEquipQty);
//			$("#right332").text(data.wrongEquipQty);
//			wrongs = data.wrongsMap;
//			setLiValue(wrongs);
//		});
		
		$.ajax({
			type : 'POST',
			url : url,
			dataType : 'json',
			data : {
				nowTime : nowTime
			},
			success : function(data) {
				$("#right112").text(data.planQty);
				$("#right122").text(data.reportQty);
				$("#right212").text(data.equipQty);
				$("#right222").text(data.startEquipQty);
				$("#right232").text(data.wrongEquipQty);
				$("#right312").text(data.wrongQty);
				console.info("data.wrongs=" + data.wrongs);
				setLiValue(data.wrongs);
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
			}
		});
	}

	//获取主屏1图表
	function getRemoteData1() {
		var un = localStorage.getItem('un');
		var pw = localStorage.getItem('pw');
		var serverIp = localStorage.getItem('serverIp');
		var serverPort = localStorage.getItem('serverPort');
		var serverProject = localStorage.getItem('serverProject');
		var url = "http://" + serverIp + ":" + serverPort + "/" + serverProject + "/autoLoginController!login.m?_u=" + un + "&_p=" + pw + "&_to=cycleOutputViewController!doSubmit.m&type=" + type + "&typeKey=" + workCenterGid + "&typeValue=" + workCenterCode + "&userName=" + userName + "&layoutShow=CYCLEOUTPUTVIEW_PC";
//		api.ajax({
//			url : url,
//			method : 'post',
//			dataType : 'json',
//			data : {
//				nowTime : new Date()
//			}
//		}, function(ret, err) {
//			var data = eval(ret);
//			chartShow(data);
//		});
		
		$.ajax({
			type : 'POST',
			url : url,
			dataType : 'json',
			data : {
			},
			success : function(data) {
				chartShow(data);
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
			}
		});
	}

	//获取主屏2图表
	function getRemoteData2() {
		var un = localStorage.getItem('un');
		var pw = localStorage.getItem('pw');
		var serverIp = localStorage.getItem('serverIp');
		var serverPort = localStorage.getItem('serverPort');
		var serverProject = localStorage.getItem('serverProject');
		var url = "http://" + serverIp + ":" + serverPort + "/" + serverProject + "/autoLoginController!login.m?_u=" + un + "&_p=" + pw + "&_to=productPlanAndCompController!doSubmit.m&type=" + type + "&typeKey=" + workCenterGid + "&typeValue=" + workCenterCode + "&userName=" + userName + "&layoutShow=PRODUCTPLANANDCOMP_PC";
		/*api.ajax({
			url : url,
			method : 'post',
			dataType : 'json',
			data : {
				nowTime : new Date()
			}
		}, function(ret, err) {
			var data = eval(ret);
			chartShow2(data);
		});*/
		$.ajax({
			type : 'POST',
			url : url,
			dataType : 'json',
			data : {
			},
			success : function(data) {
				chartShow2(data);
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
			}
		});
	}

	//获取主屏3图表
	function getRemoteData3() {
		var un = localStorage.getItem('un');
		var pw = localStorage.getItem('pw');
		var serverIp = localStorage.getItem('serverIp');
		var serverPort = localStorage.getItem('serverPort');
		var serverProject = localStorage.getItem('serverProject');
		var url = "http://" + serverIp + ":" + serverPort + "/" + serverProject + "/autoLoginController!login.m?_u=" + un + "&_p=" + pw + "&_to=echartsUqcGoodHoursLineController!doSubmit.m&type=" + type + "&typeKey=" + workCenterGid + "&typeValue=" + workCenterCode + "&userName=" + userName + "&layoutShow=tvChar3";
		/*api.ajax({
			url : url,
			method : 'post',
			dataType : 'json',
			data : {
				nowTime : new Date()
			}
		}, function(ret, err) {
			var data = eval(ret);
			chartShow3(data);
		});*/
		$.ajax({
			type : 'POST',
			url : url,
			dataType : 'json',
			data : {
			},
			success : function(data) {
				chartShow3(data);
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
			}
		});
	}

	function getRemoteData4() {
		setWAndH();
		if (changeFlag) {
			setWAndH();
		}
		var un = localStorage.getItem('un');
		var pw = localStorage.getItem('pw');
		var serverIp = localStorage.getItem('serverIp');
		var serverPort = localStorage.getItem('serverPort');
		var serverProject = localStorage.getItem('serverProject');
		var url = "http://" + serverIp + ":" + serverPort + "/" + serverProject + "/autoLoginController!login.m?_u=" + un + "&_p=" + pw + "&_to=equipStatusKanbanController!doSubmit.m&type=" + type + "&typeKey=" + workCenterGid + "&typeValue=" + workCenterCode + "&userName=" + userName + "&layoutShow=" + showModul4;
		/*api.ajax({
			url : url,
			method : 'post',
			dataType : 'json',
			data : {
			}
		}, function(ret, err) {
			var data = eval(ret);
			var dataList = eval(data.dataList);
			changeEquipStatus(dataList);
		});*/
		$.ajax({
			type : 'POST',
			url : url,
			dataType : 'json',
			data : {
			},
			success : function(data) {
				var dataList = eval(data.dataList);
				changeEquipStatus(dataList);
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
			}
		});
	}

